home *** CD-ROM | disk | FTP | other *** search
- Path: mordred.cc.jyu.fi!news
- From: David Xia <dcx@amlibs.com>
- Newsgroups: comp.lang.c++
- Subject: Re: need help with functions
- Date: Mon, 26 Feb 1996 17:20:30 -0700
- Organization: Ameritech Library Services, Provo, UT 84604-5650. USA
- Message-ID: <31324E4E.7458@amlibs.com>
- References: <4grqta$mcb@ixnews3.ix.netcom.com>
- NNTP-Posting-Host: 192.206.159.189
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0 (Win95; I)
- CC: dcx
-
- wells wrote:
- >
- > I am learning c++, I wrote this program and I have a problem with it
- > that i cant figure out. I am doin this for my class in college. I am
- > using pass by reference in my functions, and i have an error that
- > says something like.... "Get_payment is not suffieciently different
- > then Get_Payment", or something... I dont understand why.
-
- The hint to the problem is right here.
- The compiler is confused your attempt(may even not intentionly) to
- define two overloading functions.
-
- > The program has that error and 4 other warnings, I am not worried
- > about the warnings, they have to do with my pow(x,x) statement being a
- > float and not an int. I am just worried about the function error. If
- > anyone can help I would greatly appreaciate it. And let me know what I
- > am doing wrong...
- >
- > thanks very much..
- > edward
- > wells2@ix.netcom.com
- > I'm learning too.
-
- > // Function Prototype
- >
- > void Get_Payment(float,float,int,float); // Function Prototype
-
- > void Get_Payment(float &loan_amount,float &interest_rate,int
- > &number_of_payments,
- > float &payment)
-
- If you change the reference to float and int type to regular float and
- int as they are defined in the function declaration, the compiling
- error message should go away.
-
- The real problem is that the reference to the float is actually treated
- as same type to type float in compiling. So if you try to do function
- overloading, the function signature should be different. If not, then
- the parameter list of the function should be the same.
-
- Good luck
- --
- David Xia
-